home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
422mods.zip
/
PURGEUSR.422
< prev
next >
Wrap
Text File
|
1993-02-23
|
4KB
|
81 lines
Nightly User Purge Mod . . .
Dr. Dre #1 @1 7-=1Top Administrator7=-0
Mon Feb 22 07:03:56 1993
┌───────────────────────────────────────────────────────────────────────────┐
│ Mod Name : Nightly user purge Mod Author: BitByteBob 1@6755 WWIVnet │
│ │
│ Difficulty: Block copy Date : 28JAN93 │
│ │
│ Version : WWIV 4.22 File Name : BBBOB07.MOD │
│ │
│ Description: As part of the nightly routine, deletes users that have │
│ been inactive for a set period of time. Also has an │
│ exemption flag for users that you want to keep. │
│ Sends SysOp an SSM for each deleted user, and puts │
│ the info into the log. │
│ │
└───────────────────────────────────────────────────────────────────────────┘
#include <std\disclaim.doc>
This is NOT my mod, but I dont remember where the original code came from,
but I like it, so I'm releasing it again.
To keep users from being deleted, change their exemption to include 16.
Change the limit=60; line to whatever day limit you want to allow
inactivity for.
. = existing line
+ = add this line
- = delete this line
| = modify this line
Open up SYSOPF.C, and add this function to the bottom:
+void auto_user_purge(void)
+{ /* BBBOB07.MOD */
+ userrec u; /* BBBOB07.MOD */
+ int un,nu,limit; /* BBBOB07.MOD */
+ long l; /* BBBOB07.MOD */
+ unsigned int d; /* BBBOB07.MOD */
+ char s[80]; /* BBBOB07.MOD */
+ /* BBBOB07.MOD */
+ limit=60; /* Number of days of inactivity before delete. BBBOB07.MOD */
+ time(&l); /* BBBOB07.MOD */
+ un=1; /* BBBOB07.MOD */
+ read_user(un,&u); /* BBBOB07.MOD */
+ nu=(int) (filelength(userfile) / sizeof(userrec)) - 1; /* BBBOB07.MOD */
+ sprintf(s,"Auto-Purging Non-Active Users (over %d days)\r\n",limit);
+ sl1(0,s); /* BBBOB07.MOD */
+ /* BBBOB07.MOD */
+ do { /* BBBOB07.MOD */
+ read_user(un,&u); /* BBBOB07.MOD */
+ if (!(u.exempt & 0x10)) { /* BBBOB07.MOD */
+ d=(unsigned int) ((l-u.daten)/24.0/3600.0); /* BBBOB07.MOD */
+ if (((u.inact & inact_deleted)==0) && (d>limit)) { /* BBBOB07.MOD */
+ sprintf(s," ·Deleted Inactive User: #%3d %s",un,u.name);
+ ssm(1,0,s); /* BBBOB07.MOD */
+ sl1(0,s); /* BBBOB07.MOD */
+ deluser(un); /* BBBOB07.MOD */
+ } /* BBBOB07.MOD */
+ } /* BBBOB07.MOD */
+ ++un; /* BBBOB07.MOD */
+ } /* BBBOB07.MOD */
+ while (un<=nu); /* BBBOB07.MOD */
+} /* BBBOB07.MOD */
Then, go back up to the bottom of beginday(void), and add:
. if ((!syscfg.closedsystem) && (nus<15)){
. sprintf(s,get_stringx(1,19),nus);
. ssm(1,0,s);
. }
+ auto_user_purge(); /* BBBOB07.MOD */
}
Compile!